/*
 * Copyright 2010. 
 * 
 * This document may not be reproduced, distributed or used 
 * in any manner whatsoever without the expressed written 
 * permission of xrkol Corp. 
 * 
 * $Rev: Rev $
 * $Author: Author $
 * $LastChangedDate: LastChangedDate $
 *
 */

package com.xrkol.sharelib.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xrkol.sharelib.dao.LeaveRequestDao;
import com.xrkol.sharelib.entity.Clazz;
import com.xrkol.sharelib.entity.LeaveRequest;

/**
 * @author peng.xia
 *
 */
@Repository
public class LeaveRequestDaoImpl extends BaseDaoImpl<LeaveRequest, String> implements LeaveRequestDao{

    @Override
    public List<LeaveRequest> getLeaveRequestByClazz(Clazz clazz,Integer page) {
        String queryString="from LeaveRequest l where l.clazzId = ?";
        return executeQueryWithPagination(queryString, " order by l.createTime desc", page, clazz.getId());
    }

    @Override
    public List<LeaveRequest> getLeaveRequestByClazz(Clazz clazz) {
        String queryString="from LeaveRequest l where l.clazzId = ? order by l.createTime desc";
        return executeQueryWithoutPaging(queryString, clazz.getId());
    }

}
